import type { Flash, FlashPageDto } from '@/models/flash'
import type { CommonResult, CommonPage } from '@/models/request'
import request, { ContentTypeEnum } from '@/utils/request'
export function fetchList(params: FlashPageDto) {
  return request<CommonPage<Flash>>({
    url: '/flash/list',
    method: 'get',
    params: params,
  })
}
export function updateStatus(params: { status: number; id: number }) {
  return request<CommonResult>({
    url: '/flash/update/status/' + params.id,
    method: 'post',
    params: params,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}
export function deleteFlash(id: number) {
  return request<CommonResult>({
    url: '/flash/delete/' + id,
    method: 'post',
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}
export function createFlash(data: Flash) {
  return request<CommonResult>({
    url: '/flash/create',
    method: 'post',
    data: data,
  })
}
export function updateFlash(id: number, data: Flash) {
  return request<CommonResult>({
    url: '/flash/update/' + id,
    method: 'post',
    data: data,
  })
}
export function updateDetail(id: number) {
  return request<CommonResult<Flash>>({
    url: '/flash/' + id,
    method: 'get',
  })
}
